using System.Collections.Generic;
using UnityEngine;

namespace Game {
	public sealed class TeamSkin : MonoBehaviour {
		public MeshRenderer Renderer;
		public List<Color>  Colors;

		Material _material;

		public void SetTeamColor(TeamType team ) {
			if ( !Renderer ) {
				return;
			}
			if ( !_material ) {
				_material = Instantiate(Renderer.material);
				Renderer.material = _material;
			}
			var teamIndex = (int)team;
			var color = Colors[teamIndex];
			_material.SetColor("_AddColor", color);
		}
	}
}
